class PqMain extends egret.DisplayObjectContainer {
    private game: any;
    private curIndex: number = 0;
    private loadingTxt: egret.TextField;
    private loading: Loading;
    constructor() {
        super();
        this.addEventListener(egret.Event.ADDED_TO_STAGE, this.addToStage, this);
    }
    protected addToStage(event: egret.Event) {
        this.init();
    }
    private init() {
        this.loading = new Loading();
        this.addChild(this.loading);
        this.loading.x = this.stage.stageWidth / 2 - this.loading.width / 2;
        this.loading.y = this.stage.stageHeight / 2 - 15;
        this.loading.show();
        this.initBaseView();
    }
    /*初始化基础内容*/
    protected initBaseView() {
        this.loadConfig();
    }
    protected loadConfig() {
        RES.getResByUrl(Config.resList[this.curIndex], this.onResComplete, this, RES.ResourceItem.TYPE_IMAGE);
    }
    private onResComplete(e: any, url: string) {
        ResMgr.map[url] = e;
        this.curIndex++;
        if (this.curIndex < Config.resList.length) {
            this.loadConfig();
        } else {
            this.loading.close();
            this.initRES()
        }
    }
    protected initRES() {
        this.initGame();
    }
    protected initGame() {
        this.game = new PqGame();
        this.addChild(this.game);
    }
}